/**
 * 
 * @param {number} num 
 * @returns {number}
 */
function main(num) {
    if (num < 4) return num;
    const arr = [1, 2, 3, 4];
    let index = 4
    while (index < num) {
        arr.push(arr[index - 4] * arr[index - 1] - arr[index - 3] * arr[index - 2]);
        index++
    }
    return arr[num - 1];
}

module.exports = main;